<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('用油申请审批（领导）')" />
    <link rel="stylesheet" href="../../../../../../../../../../../../css/navigation.css">
</head>
<body class="gray-bg">
<div class="navigation visible-xs-block">
    <ol class="breadcrumb">
        <span> > </span>
        <li><a href="#" onclick="gomain()">主页</a></li>
        <li style="color: black">用油申请审批（领导）</li>
    </ol>
    <div class="aLine"></div>
</div>
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label style="width: 100px">归属主卡号：</label>
                            <input type="text" name="chAffiliation"/>
                        </li>
                        <li>
                            <label style="width: 100px">副油卡卡号：</label>
                            <input type="text" name="chNumber"/>
                        </li>
                        <li class="select-time">
                            <label>申请时间：</label>
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginChTime]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endChTime]"/>
                        </li>
                        <li>
                            <label>申请人：</label>
                            <input type="text" name="people"/>
                        </li>
                        <li>
                            <label style="width: 100px">申请人部门：</label>
                            <input type="text" name="depa"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="ruoyi:gasoline:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script src="../../../../../../../../../../../../js/breadcrumb.js"></script>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('ruoyi:gasoline:edit')}]];
    var removeFlag = [[${@permission.hasPermi('ruoyi:gasoline:remove')}]];
    var prefix = ctx + "ruoyi/childcardlead";
    var eStatus = [[${@dict.getType('car_up')}]];
    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            showColumns: false,
            modalName: "领导审批用油申请列表",
            columns: [
                {
                    field: 'chId',
                    title: '副油卡id',
                    visible: false
                },
                {
                    field: 'chAffiliation',
                    title: '归属主卡号'
                },
                {
                    field: 'chNumber',
                    title: '副油卡卡号'
                },
                {
                    field: 'depa',
                    title: '申请人部门'
                },
                {
                    field: 'picture',
                    title: '申请人头像',
                    align: 'center',
                    formatter: function(value, row, index) {
                        return $.table.imageView(value);
                    }
                },
                {
                    field: 'people',
                    title: '申请人',
                    align: 'center',
                },
                {
                    field: 'chTopup',
                    title: '充值金额'
                },
                {
                    field: 'chMoney',
                    title: '副油卡余额',
                    visible: false
                },
                {
                    field: 'chFile',
                    title: '里程记录',
                    align: 'center',
                    formatter: function(value, row, index) {
                        return '<a href="javascript:downloadFile(\''+row.chFile+'\')">下载</a>';
                    }
                },
                {
                    field: 'chRemark',
                    title: '备注'
                },
                {
                    field: 'text',
                    title: '审批意见'
                },
                {
                    field: 'chTime',
                    title: '申请时间'
                },
                {
                    field: 'cStatus',
                    title: '审批状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(eStatus, value);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        if (row.cStatus ==1){
                            actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="consent(\'' + row.chId + '\')"><i class="fa fa-user"></i> 通过</a> ');
                            actions.push('<a class="btn btn-warning btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.chId + '\')"><i class="fa fa-edit"></i>驳回</a> ');                        }

                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
    function downloadFile(chFile) {
        window.location.href=ctx+"common/download/resource?resource="+chFile;
    }
    function consent(chId) {
        $.modal.confirm("确认要通过申请吗?", function() {
            var url = prefix + "/consent";
            var data = { "id": chId };
            $.operate.submit(url, "post", "json", data);
        });
    }
</script>
</body>
</html>